//
//  Test12.cpp
//  CPPTest
//
//  Created by you5 Yi on 2021/9/14.
//

#include "Test12.hpp"
#include <string>
#include <fstream>
#include <iostream>

using namespace std;

void test12() {
    ofstream myFile1;
    myFile1.open("myText1.txt");
    cout<<"Enter the data in Chinese format(e.g.,2008,May 25):"<<endl;
    string Date("2008,January 1");
    string Year = Date.substr(0,4);
    int k = (int)Date.find(",");
    int i = (int)Date.find(" ");
    string Month = Date.substr(k+1,i-k-1);
    string Day = Date.substr(i+1,2);
    string NewDate = Day + " " + Month + " " + Year;
    myFile1<<"original date:"<<Date<<endl;
    myFile1<<"Converted date:"<<NewDate<<endl;
    myFile1.close();
}
